import React, {useEffect} from 'react';

function useInterval(func=()=>{},timer=5000) {
    useEffect(()=>{
        func()
        const id = setInterval(()=>{
            func()
        },timer)
        return ()=>{
            clearInterval(id);
        }
    },[])
}

export default useInterval;